package com.example.provider.config;

import com.example.provider.config.util.HttpContextHeaderHolder;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class CustomRequestInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        Map<String, Object> headers = HttpContextHeaderHolder.get();
        headers.forEach((key, value) -> {
            template.header(key, value.toString());
        });
    }
}